﻿<local:DocumentBase x:Class="WPFExcelReport.MVTEXAPP"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:ReflectionStudio.Components.UserControls;assembly=ReflectionStudio.Core"
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls" 
                    xmlns:db="clr-namespace:INTEX.DataBase"
                    xmlns:wep="clr-namespace:WPFExcelReport" 
                   Background="White" 
                    Loaded="Window_Loaded"
     >
    <local:DocumentBase.Resources>
        <ucd:BoolToVisibilityConverter x:Key="bv"/>
        <db:SETINTEXDB  x:Key="SetData" />
        <db:SETINTEXDB  x:Key="SetProd" />
        <db:SETINTEXDB  x:Key="SetEnv" />
        <CollectionViewSource   x:Key="vwART" Source="{Binding Path=ICC_EXART,Source={StaticResource SetEnv}}" />
        <CollectionViewSource   x:Key="vwTVKP" Source="{Binding Path=ICC_EXORD,Source={StaticResource SetProd}}" />
        <CollectionViewSource   x:Key="vwHVKP" Source="{Binding Path=ICC_EXORD,Source={StaticResource SetData}}" />
    </local:DocumentBase.Resources>
    <TabControl>
        <TabItem  Header="NewOrder" Background="White" Name="tabEdit">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="1*"></RowDefinition>
                </Grid.RowDefinitions>
                <StackPanel  >
                    <WrapPanel  Margin="10">

                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="80"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0" Text="New Oder"></TextBlock>
                            <Button Grid.Column="1" Height="30" Width="30" Margin="5,0,0,0"  Click="btnAddVKP_Click">
                                <Button.Background>
                                    <ImageBrush  ImageSource="Image/Add.png" />
                                </Button.Background>
                            </Button>
                            <TextBlock Grid.Column="2">OrderNo</TextBlock>
                            <TextBox Grid.Column="3" Name="txtNOrder" Width="40">1</TextBox>
                            <TextBlock Margin="10,0,0,0" Grid.Column="4" Text="User:"></TextBlock>
                            <TextBox Grid.Column="5" Name="txtUser" Width="40">MVTV</TextBox>
                        </Grid>
                        <Button FontSize="18" Height="30" Width="30" Margin="5,0,0,0" Name="btnPrint" Click="btnPrint_Click">
                            <Button.Background>
                                <ImageBrush  ImageSource="Image/Print.png" />
                            </Button.Background>
                        </Button>
                        <TextBlock Margin="5,0,0,0"  Text="打印" VerticalAlignment="Center" ></TextBlock>

                    </WrapPanel>
                    <WrapPanel  Margin="10">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <TextBlock FontSize="18" Grid.Column="0" Text="Customer:"></TextBlock>
                            <TextBox Grid.Column="1" FontSize="18" Name="txtNKD" BorderBrush="Black" Width="300"></TextBox>
                        </Grid>
                        <Grid  >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>

                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0" FontSize="18" Text="Current:"></TextBlock>
                            <TextBlock Grid.Column="1" Foreground="Red"  FontSize="18" Text="{Binding ROWNID, Source={StaticResource ResourceKey=vwTVKP}}" Width="60" ></TextBlock>
                        </Grid>
                        <Grid  >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0" FontSize="18" Text="Agent:" ></TextBlock>
                            <TextBox Grid.Column="1" Name="txtAGENT"  BorderBrush="Black" FontSize="18"  Text="{Binding CHAR1, Source={StaticResource ResourceKey=vwTVKP}}" Width="120" ></TextBox>
                        </Grid>
                        <Grid  >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0" FontSize="18" Text="A/C:" ></TextBlock>
                            <TextBox Grid.Column="1" Name="txtAC"  BorderBrush="Black" FontSize="18"  Text="{Binding CHAR2, Source={StaticResource ResourceKey=vwTVKP}}" Width="120" ></TextBox>
                        </Grid>
                        <Grid  >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0" FontSize="18" Text="Nation:" ></TextBlock>
                            <TextBox Grid.Column="1" Name="txtNATION"  BorderBrush="Black" FontSize="18"  Text="{Binding CHAR3, Source={StaticResource ResourceKey=vwTVKP}}" Width="120" ></TextBox>
                        </Grid>
                    </WrapPanel>
                    <WrapPanel  Margin="10">
                        <Grid Visibility="Collapsed" >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0" FontSize="18" Text="客户公司名:" ></TextBlock>
                            <TextBox Grid.Column="1" Name="txtCNAME"  BorderBrush="Black" FontSize="18"  Text="{Binding CHAR4, Source={StaticResource ResourceKey=vwTVKP}}" Width="200" ></TextBox>
                        </Grid>
                        <Grid  >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0" FontSize="18" Text="R1:" ></TextBlock>
                            <TextBox Grid.Column="1" Name="txtR1"  BorderBrush="Black"  FontSize="18" Width="50" ></TextBox>
                        </Grid>
                        <Grid  >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0" FontSize="18" Text="R2:" ></TextBlock>
                            <TextBox Grid.Column="1" Name="txtR2"  BorderBrush="Black" FontSize="18"  Width="50" ></TextBox>
                        </Grid>
                    </WrapPanel>
                    <WrapPanel Margin="10">
                        <Grid >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="200"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <TextBlock FontSize="18" Grid.Column="0" Text="Article: Input and Enter"></TextBlock>
                            <TextBox  FontSize="18" Grid.Column="1" Name="txtNArt" CharacterCasing="Upper" KeyUp="txtNArt_KeyUp" Text="{Binding VKPART, Source={StaticResource ResourceKey=vwTVKP}}" Width="200" ></TextBox>
                        </Grid>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="40"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0" FontSize="18" Visibility="Collapsed" Text="OK"></TextBlock>
                            <Button Grid.Column="1" Height="30" Width="30" Margin="0,0,0,0" Visibility="Collapsed"  Click="btnConfirmLine_Click">
                                <Button.Background>
                                    <ImageBrush  ImageSource="Image/button_ok.png" />
                                </Button.Background>
                            </Button>
                        </Grid>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="100"></ColumnDefinition>
                                <ColumnDefinition Width="200"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <TextBlock  FontSize="18" Grid.Column="0" Text="Color:"></TextBlock>
                            <TextBox  FontSize="18" Grid.Column="1" Name="txtNFColor" Width="200" Text="{Binding Path=VKPFARBE, Source={StaticResource ResourceKey=vwTVKP}}"></TextBox>
                        </Grid>
                        <Grid   >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="200"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <TextBlock  FontSize="18" Grid.Column="0" Text="ExhPrice:"></TextBlock>
                            <TextBox  FontSize="18" Grid.Column="1" Name="txtPrice" Text="{Binding SPRICE, Source={StaticResource ResourceKey=vwTVKP}}" Width="200"></TextBox>
                            <!--TextBox  FontSize="18" Grid.Column="2" Name="txtUM"  Visibility="Collapsed" Text="{Binding CHAR1, Source={StaticResource ResourceKey=vwTVKP}}" Width="200"></TextBox-->
                        </Grid>
                    </WrapPanel>
                    <Grid Margin="10">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <TextBlock  FontSize="18" Grid.Column="0" Text="Remark:"></TextBlock>
                        <TextBox   FontSize="18" Grid.Column="1" Name="txtRemark" Height="50" Width="800"   TextWrapping="Wrap"
                                   Text="{Binding Path=REMARK, Source={StaticResource ResourceKey=vwTVKP}}" Margin="1,0,0,0"/>
                    </Grid>
                </StackPanel>
                <Grid Grid.Row="1">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"></RowDefinition>
                        <RowDefinition Height="1*"></RowDefinition>
                    </Grid.RowDefinitions>
                    <WrapPanel Name="EditCurrent" Visibility="Collapsed">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0"  Margin="20,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center"   Text="删除"></TextBlock>
                            <Button Grid.Column="1"   Margin="20,0,0,0"  Width="40" Height="40" Click="Del_Click"  >
                                <Button.Background>
                                    <ImageBrush ImageSource="Image/Delete.png" />
                                </Button.Background>
                            </Button>
                        </Grid>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="1"  Margin="20,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center"   Text="Save"></TextBlock>
                            <TextBlock Grid.Column="0"  Margin="20,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center"   Text="修改时需要保存"></TextBlock>
                            <Button Grid.Column="2"    Margin="20,0,0,0"  Width="40" Height="40" Click="Save_Click" Visibility="{Binding ModeEdit, Converter={StaticResource ResourceKey=bv}}" >
                                <Button.Background>
                                    <ImageBrush ImageSource="Image/Save.png" />
                                </Button.Background>
                            </Button>
                        </Grid>
                    </WrapPanel>
                    <DataGrid  Grid.Row="1"  VerticalAlignment="Top"  
                                   AutoGenerateColumns="False"
                                   EnableRowVirtualization="False"
                                   VerticalScrollBarVisibility="Auto"
                                   HorizontalScrollBarVisibility="Auto"
                                   HeadersVisibility="Column"     
                                   ItemsSource="{Binding Source={StaticResource ResourceKey=vwTVKP}}"  
                                   x:Name="dlgVKP"  
                                   RowDetailsVisibilityMode="Visible" Grid.ColumnSpan="2" Margin="0,0.2,0.2,0"
                    >
                        <DataGrid.Columns>
                            <DataGridTextColumn Binding="{Binding Path=ROWNID}" Header="ROWNID"  Width="Auto" />
                            <DataGridTextColumn Binding="{Binding Path=CUSTOMER}" Header="CUSTOMER"  Width="Auto" />
                            <DataGridTextColumn Binding="{Binding Path=VKPART}" Header="ART"  Width="Auto" />
                            <DataGridTextColumn Binding="{Binding Path=VKPFARBE}" Header="Color"  Width="Auto" />
                            <DataGridTextColumn Binding="{Binding Path=SPRICE}" Header="PRICE"  Width="Auto" />
                            <DataGridTextColumn Binding="{Binding Path=TWIDTH}" Header="TWIDTH"  Width="Auto" />
                            <DataGridTextColumn Binding="{Binding Path=VWIDTH}" Header="VWIDTH"  Width="Auto" />
                            <DataGridTextColumn Binding="{Binding Path=GSQM}" Header="GSQM"  Width="Auto" />
                            <DataGridTextColumn Binding="{Binding Path=COMPOSITION}" Header="COMPOSITION"  Width="Auto" />
                            <DataGridTextColumn Binding="{Binding Path=REMARK}" Header="REMARK"  Width="Auto" />
                            <DataGridTextColumn Binding="{Binding Path=CHAR1}" Header="AGENT"  Width="Auto" />
                            <DataGridTextColumn Binding="{Binding Path=CHAR2}" Header="A/C"  Width="Auto" />
                            <DataGridTextColumn Binding="{Binding Path=CHAR3}" Header="NATION"  Width="Auto" />
                            <DataGridTextColumn Binding="{Binding Path=CHAR4}" Header="客户公司名"  Width="Auto" />
                            <DataGridTextColumn Binding="{Binding Path=NUMBER1}" Header="R1"  Width="Auto" />
                            <DataGridTextColumn Binding="{Binding Path=NUMBER2}" Header="R2"  Width="Auto" />
                        </DataGrid.Columns>
                    </DataGrid  >
                </Grid>
            </Grid>
        </TabItem>
        <TabItem Header="ArtcleList" Background="White" >
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="1*"></RowDefinition>
                </Grid.RowDefinitions>
                <WrapPanel Grid.Row="0" Grid.ColumnSpan="2">
        
                    <Grid Margin="20,0,0,0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <TextBlock Grid.Column="0" Text="Article" VerticalAlignment="Center" ></TextBlock>
                        <TextBox Grid.Column="1"   Name="txtLART" Background="LightYellow" CharacterCasing="Upper"  Width="200" Height="30"></TextBox>

                    </Grid>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <TextBlock Grid.Column="0"  Width="Auto" VerticalAlignment="Center" HorizontalAlignment="Center"   Text="LoadArt"  ></TextBlock>
                        <Button Grid.Column="1"  Margin="0,0,0,0"  Width="30" Height="30" Click="btnLoadArt_Click">
                            <Button.Background>
                                <ImageBrush ImageSource="Image/Reload.png" />
                            </Button.Background>
                        </Button>
                    </Grid>
                    <Grid Visibility="Collapsed">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Button Grid.Column="0"    Width="30" Height="30" Click="cmdFilterART_Click">
                            <Button.Background>
                                <ImageBrush ImageSource="Image/Search.png" />
                            </Button.Background>
                        </Button>
                        <Button Grid.Column="1"  Name="btnArtClear" Click="btnArtClear_Click" Width="Auto">Clear</Button>
                    </Grid>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                    </Grid>
                </WrapPanel>
                <DataGrid  Grid.Row="1" VerticalAlignment="Top"  Grid.Column="0"
                                   AutoGenerateColumns="False"
                                   EnableRowVirtualization="False"
                                   VerticalScrollBarVisibility="Auto"
                                   HorizontalScrollBarVisibility="Auto"
                                   HeadersVisibility="Column"                 
                                   HorizontalAlignment="Stretch"               
                                   ItemsSource="{Binding Source={StaticResource ResourceKey=vwART}}"  
                                   x:Name="dlgART" 
                                   Margin="0,1,0,0"             
                                   RowDetailsVisibilityMode="Visible" Grid.ColumnSpan="4"
                    >
                    <DataGrid.Columns>
                        <DataGridTextColumn Binding="{Binding Path=ROWNID}" Header="ROWNID"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=ARTICLE}" Header="ARTICLE"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=DESCRIPTION}" Header="DESCRIPTION"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=TWIDTH}" Header="TWIDTH"  Width="Auto" /> 
                        <DataGridTextColumn Binding="{Binding Path=GSQM}" Header="GSQM"  Width="Auto" />  
                        <DataGridTextColumn Binding="{Binding Path=SPRICE}" Header="SPRICE"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=YARN}" Header="YARN"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=COMPOSITION}" Header="COMPOSITION"  Width="Auto" /> 
                    </DataGrid.Columns>
                </DataGrid  >
            </Grid>
        </TabItem>
        <TabItem Header="EventOrderList" Background="White">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="1*"></RowDefinition>
                    <RowDefinition Height="1*"></RowDefinition>
                </Grid.RowDefinitions>
                <WrapPanel Grid.Row="0"  Margin="0,0,0,0">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto">
                            </ColumnDefinition>
                            <ColumnDefinition Width="Auto">
                            </ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <TextBlock Grid.Column="0"
                                    VerticalAlignment="Center" HorizontalAlignment="Center"   Text="LoadLocalDB"></TextBlock>
                        <Button Grid.Column="1" Width="40" Height="40" Margin="20,0,0,0" Click="Load_Click" >
                            <Button.Background>
                                <ImageBrush ImageSource="Image/Refresh.png" />
                            </Button.Background>
                        </Button>
                    </Grid>

                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <TextBlock Grid.Column="0"  Margin="20,0,0,0" 
                                    VerticalAlignment="Center" HorizontalAlignment="Center"   Text="LFD"></TextBlock>
                        <TextBox Grid.Column="1"  Margin="20,0,0,0"  Name="txtLFD" CharacterCasing="Upper"  Width="40" Height="30"></TextBox>
                    </Grid>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <TextBlock Grid.Column="0"  Margin="20,0,0,0" 
                                    VerticalAlignment="Center" HorizontalAlignment="Center"   Text="品种"></TextBlock>
                        <TextBox Grid.Column="1"  Margin="20,0,0,0"  Name="txtART" CharacterCasing="Upper"  Width="100" Height="30"></TextBox>
                    </Grid> 
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto">
                            </ColumnDefinition>
                            <ColumnDefinition Width="Auto">
                            </ColumnDefinition>
                            <ColumnDefinition Width="Auto">
                            </ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <TextBlock Grid.Column="0"  Margin="20,0,0,0" 
                                    VerticalAlignment="Center" HorizontalAlignment="Center"   Text="来单日期"></TextBlock>
                        <ComboBox Grid.Column="1"  IsEditable="True" Name="cmbNDate" Width="100" Height="30"></ComboBox>
                    </Grid>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Button Grid.Column="0"  Margin="20,0,0,0"  Width="30" Height="30" Click="btnFilter_Click">
                            <Button.Background>
                                <ImageBrush ImageSource="Image/Search.png" />
                            </Button.Background>
                        </Button>
                        <Button Grid.Column="1"   Click="btnFilterClear_Click">Clear</Button>
                    </Grid>
                    <Button FontSize="18" Height="30" Width="30" Margin="5,0,0,0"  Click="btnPrint_Click">
                        <Button.Background>
                            <ImageBrush  ImageSource="Image/Print.png" />
                        </Button.Background>
                    </Button>
                    <TextBlock Margin="5,0,0,0"  Text="打印" VerticalAlignment="Center" ></TextBlock>
                </WrapPanel>
                <DataGrid Grid.Row="1"
                    VerticalAlignment="Top"  
                                   AutoGenerateColumns="False"
                                   EnableRowVirtualization="False"
                                   VerticalScrollBarVisibility="Auto"
                                   HorizontalScrollBarVisibility="Auto"
                                   HeadersVisibility="Column"                 
                                   HorizontalAlignment="Stretch"   
                          Name="dlgNOrders"
                                   ItemsSource="{Binding Source={StaticResource ResourceKey=vwHVKP}}"                                 
                                   Margin="0,0,0,0"             
                                   RowDetailsVisibilityMode="Visible" 
                    >
                    <DataGrid.Columns>
                        <DataGridTextColumn Binding="{Binding Path=ROWNID}" Header="ROWNID"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=VKPAUFKRS}" Header="KRS"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=VKPAUFLFD}" Header="LFD"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=VKPAUFPOS}" Header="POS"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=ITEM}" Header="ITEM"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=VKPART}" Header="VKPART"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=VKPARTDES}" Header="VKPARTDES"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=VKPFARBE}" Header="VKPFARBE"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=VKPCDES}" Header="VKPCDES"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=TWIDTH}" Header="TWIDTH"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=VWIDTH}" Header="VWIDTH"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=GSQM}" Header="GSQM"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=GM}" Header="GM"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=PRICE}" Header="PRICE"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=SPRICE}" Header="SPRICE"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=YARN}" Header="YARN"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=COMPOSITION}" Header="COMPOSITION"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=ORDTYPE}" Header="ORDTYPE"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=QUANTITY}" Header="QUANTITY"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=CUSTOMER}" Header="CUSTOMER"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=VKPNEUDAT}" Header="VKPNEUDAT"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=VKPNEUTIME}" Header="VKPNEUTIME"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=VKPNUEBEN}" Header="VKPNUEBEN"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=REMARK}" Header="REMARK"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=NUMBER1}" Header="NUMBER1"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=NUMBER2}" Header="NUMBER2"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=NUMBER3}" Header="NUMBER3"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=NUMBER4}" Header="NUMBER4"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=NUMBER5}" Header="NUMBER5"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=CHAR1}" Header="CHAR1"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=CHAR2}" Header="CHAR2"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=CHAR3}" Header="CHAR3"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=CHAR4}" Header="CHAR4"  Width="Auto" />
                        <DataGridTextColumn Binding="{Binding Path=CHAR5}" Header="CHAR5"  Width="Auto" />
                    </DataGrid.Columns>
                </DataGrid  >
                <Grid Grid.Row="2">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"></RowDefinition>
                        <RowDefinition Height="1*"></RowDefinition>
                    </Grid.RowDefinitions>
                    <WrapPanel Grid.Row="0">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto">
                                </ColumnDefinition>
                                <ColumnDefinition Width="54">
                                </ColumnDefinition>
                                <ColumnDefinition Width="6"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0"  Margin="20,12,0,12" 
                                    VerticalAlignment="Center" HorizontalAlignment="Center"   Text="Edit"></TextBlock>
                            <Button Grid.Column="1"  Margin="20,0,0,0"  Width="40" Height="40" Click="Edit_Click" Grid.ColumnSpan="2" >
                                <Button.Background>
                                    <ImageBrush ImageSource="Image/Open.png" />
                                </Button.Background>
                            </Button>
                        </Grid>
                    </WrapPanel>
                    <DataGrid  Grid.Row="1"   VerticalAlignment="Top"  
                                   AutoGenerateColumns="False"
                                   EnableRowVirtualization="False"
                                   VerticalScrollBarVisibility="Auto"
                                   HorizontalScrollBarVisibility="Auto"
                                   HeadersVisibility="Column"     
                                   ItemsSource="{Binding Source={StaticResource ResourceKey=vwTVKP}}"    
                                   RowDetailsVisibilityMode="Visible"
                    >
                        <DataGrid.Columns>
                            <DataGridTextColumn Binding="{Binding Path=ROWNID}" Header="ROWNID"  Width="Auto" />
                            <DataGridTextColumn Binding="{Binding Path=CUSTOMER}" Header="CUSTOMER"  Width="Auto" />
                            <DataGridTextColumn Binding="{Binding Path=VKPART}" Header="ART"  Width="Auto" />
                            <DataGridTextColumn Binding="{Binding Path=VKPFARBE}" Header="Color"  Width="Auto" />
                            <DataGridTextColumn Binding="{Binding Path=PRICE}" Header="PRICE"  Width="Auto" />
                            <DataGridTextColumn Binding="{Binding Path=TWIDTH}" Header="TWIDTH"  Width="Auto" />
                            <DataGridTextColumn Binding="{Binding Path=VWIDTH}" Header="VWIDTH"  Width="Auto" />
                            <DataGridTextColumn Binding="{Binding Path=GSQM}" Header="GSQM"  Width="Auto" />
                            <DataGridTextColumn Binding="{Binding Path=COMPOSITION}" Header="COMPOSITION"  Width="Auto" />
                            <DataGridTextColumn Binding="{Binding Path=REMARK}" Header="REMARK"  Width="Auto" />
                            <DataGridTextColumn Binding="{Binding Path=CHAR1}" Header="AGENT"  Width="Auto" />
                            <DataGridTextColumn Binding="{Binding Path=CHAR2}" Header="A/C"  Width="Auto" />
                            <DataGridTextColumn Binding="{Binding Path=CHAR3}" Header="NATION"  Width="Auto" />
                            <DataGridTextColumn Binding="{Binding Path=CHAR4}" Header="客户公司名"  Width="Auto" />
                            <DataGridTextColumn Binding="{Binding Path=NUMBER1}" Header="R1"  Width="Auto" />
                            <DataGridTextColumn Binding="{Binding Path=NUMBER2}" Header="R2"  Width="Auto" />
                        </DataGrid.Columns>
                    </DataGrid  >
                </Grid>
            </Grid>
        </TabItem>
        <TabItem Header="Management" Background="White">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="113*"/>
                    <ColumnDefinition Width="207*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="1*"></RowDefinition>
                </Grid.RowDefinitions>
                <WrapPanel Grid.Row="0"   Margin="20,0,0.2,0.4" Grid.ColumnSpan="2">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <TextBlock Grid.Column="0"  Width="Auto" VerticalAlignment="Center" HorizontalAlignment="Center"   Text="ResetDB"  ></TextBlock>
                        <Button Grid.Column="1"  Margin="0,0,0,0"  Width="30" Height="30" Click="btnResetDB_Click">
                            <Button.Background>
                                <ImageBrush ImageSource="Image/Refresh.png" />
                            </Button.Background>
                        </Button>
                    </Grid>
                    <WrapPanel Visibility="Collapsed">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto">
                                </ColumnDefinition>
                                <ColumnDefinition Width="Auto">
                                </ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0"
                                    VerticalAlignment="Center" HorizontalAlignment="Center"   Text="Convert EXCEL Local DB"></TextBlock>
                            <Button Grid.Column="1" Width="40" Height="40"  Click="Conver2xml_Click">
                                <Button.Background>
                                    <ImageBrush ImageSource="Image/Refresh.png" />
                                </Button.Background>
                            </Button>
                        </Grid>
                        <Grid Margin="20,0,0,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto">
                                </ColumnDefinition>
                                <ColumnDefinition Width="Auto">
                                </ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0"
                                    VerticalAlignment="Center" HorizontalAlignment="Center"   Text="Export to EXCEL"></TextBlock>
                            <Button Grid.Column="1" Width="40" Height="40" Click="Convert2exl_Click" >
                                <Button.Background>
                                    <ImageBrush ImageSource="Image/Convert.png" />
                                </Button.Background>
                            </Button>
                        </Grid>
                    </WrapPanel>
                </WrapPanel>

            </Grid>
        </TabItem>
    </TabControl>
</local:DocumentBase>